Skip to content

fix(migrations): harden v0.29.1 on PGLite + guard effective_date index creation#743

Closed
DrBaher wants to merge 1 commit into
garrytan:masterfrom
DrBaher:fix/v0291-pglite-connect-effective-date-index
Closed

fix(migrations): harden v0.29.1 on PGLite + guard effective_date index creation#743
DrBaher wants to merge 1 commit into
garrytan:masterfrom
DrBaher:fix/v0291-pglite-connect-effective-date-index

Conversation

@DrBaher
Copy link
Copy Markdown

@DrBaher DrBaher commented May 8, 2026

Summary

This fixes two migration hardening issues seen on PGLite upgrades:

  1. v0.29.1 orchestrator used an engine before connecting

    • Could fail with: PGLite not connected. Call connect() first.
    • phaseBBackfill and phaseCVerify now call connectWithRetry(...) before DB work and disconnect() afterwards.
  2. Schema bootstrap could reference effective_date too early

    • On partially-upgraded brains, creating pages_coalesce_date_idx could fail if pages.effective_date was not yet present.
    • Index creation is now guarded by a column-existence check in schema SQL.

Files changed

  • src/commands/migrations/v0_29_1.ts
  • src/core/schema-embedded.ts
  • src/core/pglite-schema.ts
  • src/schema.sql

Verification

  • bun run typecheck
  • Local reproduction previously stuck at partial 0.29.1; with this change, migration completed and doctor advanced from unhealthy to warnings with schema at latest.

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

@garrytan
Copy link
Copy Markdown
Owner

garrytan commented May 9, 2026

Thanks for the contribution! This is being closed because it was superseded by #740 in #776 (PGLite hardening covered by UNSAFE_TRANSACTION + connect fix). Real fix shipped; your name will appear in the v0.30.3 release notes attribution where applicable. Thank you again.

@garrytan garrytan closed this May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants